package com.sync.syncmasterdata.outsystem.service;

import com.sync.syncmasterdata.outsystem.entity.CrmContactErpAnmEntity;
import com.sync.syncmasterdata.outsystem.entity.CusDeliverAddErpAnmEntity;
import com.sync.syncmasterdata.outsystem.entitymbt.CrmContactErpMBTEntity;
import com.sync.syncmasterdata.outsystem.entitymbt.CusDeliverAddErpMBTEntity;
import com.sync.syncmasterdata.outsystem.repository.AmCrmContractRepository;
import com.sync.syncmasterdata.outsystem.repository.AmShippingAddressRepository;
import com.sync.syncmasterdata.outsystem.repositorymbt.MBTCrmContractRepository;
import com.sync.syncmasterdata.outsystem.repositorymbt.MBTShippingAddressRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 体外ERP 用与sql 创建客户地址及客户联系人信息
 */

@Service
@Slf4j
public class CustomerAddAndContactService {

    @Autowired
    private AmCrmContractRepository amCrmContractRepository;

    @Autowired
    private AmShippingAddressRepository amShippingAddressRepository;

    @Autowired
    private MBTCrmContractRepository mbtCrmContractRepository;

    @Autowired
    private MBTShippingAddressRepository mbtShippingAddressRepository;

    //推送安迈 创建U8 联系人信息
    public void createCrmContractToU8(CrmContactErpAnmEntity entity) {
        CrmContactErpAnmEntity retEntity=amCrmContractRepository.save(entity);
        if (retEntity != null) {
            log.info("CrmContractToU8===>>成功");
        }
    }

    //创建安迈 收货地址
    public void createShippingAddressToU8(CusDeliverAddErpAnmEntity entity) {
        CusDeliverAddErpAnmEntity retEntity = amShippingAddressRepository.save(entity);
        if (retEntity != null) {
            log.info("createShippingAddressToU8===>>成功");
        }
    }

    //推送美博特 创建U8 联系人信息
    public void createCrmContractToU8(CrmContactErpMBTEntity entity) {
        CrmContactErpMBTEntity retEntity=mbtCrmContractRepository.save(entity);
        if (retEntity != null) {
            log.info("CrmContractToU8===>>成功");
        }
    }

    //创建美博特 收货地址
    public void createShippingAddressToU8(CusDeliverAddErpMBTEntity entity) {
        CusDeliverAddErpMBTEntity retEntity = mbtShippingAddressRepository.save(entity);
        if (retEntity != null) {
            log.info("createShippingAddressToU8===>>成功");
        }
    }





}
